import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
// https://vite.dev/config/
const ts = Date.now()
export default defineConfig({
  plugins: [tailwindcss(),react()],
  resolve:{
    alias:{
      '@':'src'
    }
  },
   server: {
    proxy: {
      '/api': {
        target: 'http://172.27.2.110',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
    }
  },
  build:{
    outDir:'viteBuild',
    copyPublicDir:true,
    rollupOptions:{
      output:{
        entryFileNames:`js/[name]-[hash]-${ts}.js`,
        chunkFileNames:`js/[name]-[hash]-${ts}.js`,
        assetFileNames:`ext/[name]-[hash]-${ts}.ext`
      }
    }
  }
})
